/**
 * @description 本地数据库
 */
export default class localStorage {
  // eslint-disable-next-line no-empty-pattern
  constructor({} = {}) {}
  /**
   * 存储localStorage
   */
  static set(name, content) {
    if (!name) return;
    if (typeof content !== "string") {
      content = JSON.stringify(content);
    }
    window.localStorage.setItem(name, content);
  }
  /**
   * 获取localStorage
   */
  static get(name) {
    if (!name) return;
    var value = window.localStorage.getItem(name);
    if (value !== null) {
      try {
        value = JSON.parse(value);
      } catch (e) {
        value = value;
      }
    }
    return value;
  }
  /**
   * 删除localStorage
   */
  static remove(name) {
    if (!name) return;
    window.localStorage.removeItem(name);
  }
}
